<template>
	<view class="cash_out">
		<view class="item">
			<text class="t1">真实姓名</text>
			<text class="t2">{{checkInfo.name}}</text>
		</view>
		<view class="item">
			<text class="t1">提现银行</text>
			<text class="t2">{{checkInfo.bank_name}}</text>
		</view>
		<view class="item">
			<text class="t1">银行卡号</text>
			<text class="t2">{{checkInfo.card_no}}</text>
		</view>
		
		<view class="cash_input">
			<view class="cash_money_text">提现金额</view>
			<view class="cash_money">
				<text>￥</text>
				<input type="number" v-model="money" :placeholder="info.money"></input>
			</view>
			<view class="now">
				<text class="t1">账号余额:￥{{userInfo.money||'0.00'}}</text>
				<text class="t2">提现收取手续费 {{userInfo.cash_rate||'0.00'}}%</text>
			</view>
		</view>
		
		<view class="log-out-btn" @click="add_cash">
			预计48小时到账，确定提现
		</view>
		
	</view>
</template>

<script>
	export default {
		components:{
		},
		data() {
			return {
				info:{},
				checkInfo:{},
				userInfo:{},
				money:0,
			};
		},
		onLoad() {
			this.get_info();
			// this.add_cash(false);
		},
		methods:{
			add_cash(e){
				
				let obj = {...this.$api.cashes}
				obj.method = 'post'
				this.$http(obj,{money:this.money}).then(res=>{
					if(res.code == 200){
						this.$emit('users')
						this.$toast(res.msg)
						return this.$nav('',3);
					}else{
						this.$toast(res.msg)
					}
					
				})
			},
			
			// 获取身份是否认证
			get_info(){
				let obj = {...this.$api.cashes}
				obj.url = obj.url+'/show'
				obj.method = 'get'
				this.$http(obj).then(res=>{
					if(res.code == 200){
						this.userInfo = res.data;
						this.checkInfo = res.data.user_check;
					}else{
						this.$nav('/pages/user_check/check.vue');
					}
				})
			},
		
		}
	}
</script>

<style lang="scss">

.cash_out{
	border-top: 1px solid #efefef;
	font-size: 28rpx;
	.log-out-btn{
		display: flex;
		align-items: center;
		justify-content: center;
		width: 690rpx;
		height: 80rpx;
		margin: 60rpx auto;
		color: #fff;
		background-color: #ea1f22;
		border-radius: 10rpx;
		box-shadow: 1px 2px 5px rgba(219, 40, 43, 0.4);	
	}
	.cash_input{
		margin-top: 20rpx;
		background-color: #fff;
		padding: 30rpx;
		.cash_money_text{
			font-size: 30rpx;
			color:#999;
			margin-bottom: 30rpx;
		}
		.cash_money{
			text{
				font-size: 60rpx;
				float: left;
			}
			input{
				float: left;
				font-size: 34rpx;
				line-height: 70rpx;
				height: 70rpx;
				border-bottom: 1px solid #f1f1f1;
			}
			&:after{
				content:'';
				display: block;
				clear: both;
			}
		}
		.now{
			margin-top: 20rpx;
			.t1{
				float: left;
				color:#999;
			}
			.t2{
				float: right;
				color:$uni-color-error;
			}
			&:after{
				content:'';
				display: block;
				clear: both;
			}
		}
	}
	.item{
		border-bottom: 1px solid #f1f1f1;
		line-height: 50rpx;
		box-sizing: border-box;
		padding: 30rpx;
		background-color: #fff;
		.t1{margin-right: 20rpx;}
		.t2{color:#999;}
	}
}
</style>
